<template>
  <div v-if="Object.keys(shop).length !== 0" class="detailshopinfo">
    <div class="shop">
      <img :src="shop.shopLogo" alt="" />
      <span>{{ shop.name }}</span>
    </div>
    <div class="shopgoods">
      <div class="left">
        <span>
          <p>{{ shop.cSells | sellCountFilter }}</p>
          <p>总销量</p>
        </span>
        <span>
          <p>{{ shop.cGoods }}</p>
          <p>全部宝贝</p>
        </span>
      </div>
      <div class="right">
        <table cellspacing="10">
          <tr v-for="(item, index) in shop.score">
            <td>{{ item.name }}</td>
            <td class="score" :class="{ scorecss: item.isBetter }">
              {{ item.score }}
            </td>
            <td class="isBetter" :class="{ isBettercss: item.isBetter }">
              {{ item.isBetter ? "高" : "低" }}
            </td>
          </tr>
        </table>
      </div>
    </div>
    <div class="entershop">进店逛逛</div>
  </div>
</template>

<script>
export default {
  name: "DetailShopInfo",
  props: {
    shop: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  data() {
    return {};
  },
  computed: {},
  methods: {},
  filters: {
    sellCountFilter(value) {
      let result = value;
      if (value > 10000) {
        result = (result / 10000).toFixed(1) + "万";
      }
      return result;
    },
  },
  components: {},
};
</script>

<style  scoped>
.detailshopinfo {
  margin: 20px 0px;
}
.shop {
  margin-top: 15px;
}
.shop img {
  width: 10%;
  vertical-align: middle;
  margin: 0px 10px;
}
.shopgoods {
  display: flex;
  padding: 5px 20px;
  font-size: 12px;
  text-align: center;
  height: 100px;
}
.shopgoods > div {
  flex: 1;
  float: left;
}

.shopgoods .left,
.right {
  display: flex;
  align-items: center;
  justify-content: center;
}

.shopgoods .left > span {
  display: flex;
  flex-flow: column nowrap;
  flex: 1;
  float: left;
}
.shopgoods .left > span p {
  flex: 1;
  line-height: 24px;
}
.left > span p:first-child {
  font-size: 16px;
  flex: 1;
}
.left > span:last-child {
  border-right: 1px solid gray;
}
.isBetter {
  color: white;
  background-color: green;
}
.score {
  color: green;
}
.right .scorecss {
  color: red;
}
.right .isBettercss {
  background-color: red;
  color: white;
}
.entershop {
  width: 140px;
  margin: auto;
  height: 25px;
  line-height: 25px;
  text-align: center;
  background-color: rgb(233, 235, 241);
  border-radius: 5px;
  font-size: 14px;
}
</style>
